/**
 * Copyright (c) 2010-2011 Pierre Labatut
 *
 * This file is part of Space-Chronicles project.
 *
 * Space-Chronicles is free software: you can redistribute it and/or modify it
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or <http://code.google.com/p/space-chronicles/>.
 */
package space.input;

import java.util.Iterator;
import net.java.games.input.Component;
import net.java.games.input.Component.Identifier;
import net.java.games.input.Controller;
import net.java.games.input.EventQueue;
import net.java.games.input.Rumbler;
import space.input.Record.Frame;

/**
 *
 * @author Pierre Labatut
 */
public class PlayControler implements Controller {

    private final Iterator<Frame> record;
    Frame frame;

    public PlayControler(final Record record) {
        this.record = record.iterator();
    }

    public Controller[] getControllers() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Type getType() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Component[] getComponents() {
        return new Component[]{};
    }

    public Component getComponent(Identifier idntfr) {
        return new PlayComponent(this, idntfr.getName());
    }

    public Rumbler[] getRumblers() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public boolean poll() {
        frame = record.next();
        return true;
    }

    public void setEventQueueSize(int i) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public EventQueue getEventQueue() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public PortType getPortType() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public int getPortNumber() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public String getName() {
        return "Record Player";
    }

    Frame getCurrentFrame() {
        return frame;
    }
}
